# CMake configuration file for folly
#
# This provides the Folly::folly target, which you can depend on by adding it
# to your target_link_libraries().
#
# It also defines the following variables, although using these directly is not
# necessary if you use the Folly::folly target instead.
#  FOLLY_INCLUDE_DIR
#  FOLLY_LIBRARIES

@PACKAGE_INIT@

include(CMakeFindDependencyMacro)

set_and_check(FOLLY_INCLUDE_DIRS "@PACKAGE_INCLUDE_INSTALL_DIR@")
set_and_check(FOLLY_INCLUDE_DIR "@PACKAGE_INCLUDE_INSTALL_DIR@")
set_and_check(FOLLY_CMAKE_DIR "@PACKAGE_CMAKE_INSTALL_DIR@")

# find_dependency() ends up changing PACKAGE_PREFIX_DIR, so save
# folly's prefix directory in the FOLLY_PREFIX_DIR variable
set(FOLLY_PREFIX_DIR "${PACKAGE_PREFIX_DIR}")

# Include the folly-targets.cmake file, which is generated from our CMake rules
if (NOT TARGET Folly::folly)
  include("${FOLLY_CMAKE_DIR}/folly-targets.cmake")
endif()

# Set FOLLY_LIBRARIES from our Folly::folly target
set(FOLLY_LIBRARIES Folly::folly)

# Find folly's dependencies
find_dependency(fmt)

set(Boost_USE_STATIC_LIBS "@FOLLY_BOOST_LINK_STATIC@")
find_package(Boost 1.69.0 REQUIRED
  COMPONENTS
    context
    filesystem
    program_options
    regex
    thread
)

if (NOT folly_FIND_QUIETLY)
  message(STATUS "Found folly: ${FOLLY_PREFIX_DIR}")
endif()
